package com.example.modbus;

import com.example.modbus.utils.ModbusUtilsInterFace;
import com.serotonin.modbus4j.ModbusMaster;



/**
 * @author weiliangkang
 * @date 2020/12/3 14:27
 */
public class ModbusRtuMaster{

    public static void main(String[] args) throws Exception {
        ModbusUtilsInterFace modbusUtils = new ModbusUtilsInterFace();
        ModbusMaster tcpMaster = modbusUtils.getTCPMaster("127.0.0.1", 502);
//        int i = modbusUtils.readHoldingRegister(tcpMaster, 1, 1, DataType.TWO_BYTE_INT_SIGNED).intValue();
        modbusUtils.batchRead(tcpMaster);

    }


}
